import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/layout/index.vue'
import es6Route from './es6'
// 多级路由
import routerView from '@/components/routerView/index.vue'
Vue.use(VueRouter)

// import vueRouteList from '../views/vue.ts'
// console.log(vueRouteList)

export const routes = [
  {
    path: '/',
    redirect: '/wendou/index',
    meta: { hidden: true }
  },
  {
    path: '/home',
    name: 'home',
    component: Layout,
    meta:{
      title:'首页'
    },
    children:[
      {
        path: 'index',
        component: () => import(/* webpackChunkName: "wendou" */ '@/views/home/index.vue'),
      }
    ]
  },
  {
    path: '/dahua',
    name: 'dahua',
    component: Layout,
    meta:{
      title:'大华ic读卡器'
    },
    children:[
      {
        path: 'index',
        component: () => import(/* webpackChunkName: "wendou" */ '@/views/dahua/index.vue'),
      }
    ]
  },
  {
    path: '/wendou',
    name: 'wendou',
    redirect: '/wendou/index',
    component: Layout,
    children:[
      {
        meta:{
          title:'文豆高拍'
        },
        path: 'index',
        component: () => import(/* webpackChunkName: "home" */ '@/views/wendou/index.vue'),
      }
    ]
  },
  {
    path: '/apiDom',
    name: 'apiDom',
    redirect: '/apiDom/index',
    component: Layout,
    meta:{
      title:'调用接口'
    },
    children:[
      {

        path: 'index',
        component: () => import(/* webpackChunkName: "apiDom" */ '@/views/apiDom/index.vue'),
      }
    ]
  },
  {
    path: '/geci',
    name: 'geci',
    redirect: '/geci/index',
    component: Layout,
    children:[
      {
        meta:{
          title:'歌词滚动'
        },
        path: 'index',
        component: () => import(/* webpackChunkName: "apiDom" */ '@/views/geci/index.vue'),
      }
    ]
  },
  {
    path: '/css',
    name: 'css',
    redirect: '/css/index',
    component: Layout,
    children:[
      {
        meta:{
          title:'css效果'
        },
        path: 'index',
        component: () => import(/* webpackChunkName: "apiDom" */ '@/views/css/index.vue'),
      }
    ]
  },
  {
    path: '/canvas',
    name: 'canvas',
    redirect: '/canvas/index',
    component: Layout,
    children:[
      {
        meta:{
          title:'canvas效果'
        },
        path: 'index',
        component: () => import(/* webpackChunkName: "apiDom" */ '@/views/canvas/index.vue'),
      }
    ]
  },
  {
    path: '/js',
    name: 'js',
    redirect: '/js/index',
    component: Layout,
    meta:{
      title:'jsAPIdemo'
    },
    children:[
      {
        path: 'index',
        component: () => import(/* webpackChunkName: "apiDom" */ '@/views/js/index.vue'),
      }
    ]
  },
  {
    path: '/es6',
    name: 'es6',
    component: Layout,
    meta:{
      title:'es6'
    },
    children:[
      {
        path: '3',
        meta:{
          title:'3.语言基础'
        },
        name: 3,
        component: routerView ,
        children:[
          {
            meta:{
              title:'1-语法'
            },
            path: 'language',
            component: () => import(/* webpackChunkName: "es6-3-1" */ '@/views/es6/3/language/index.vue'),
          },
          {
            meta:{
              title:'2-关键字与保留字'
            },
            path: 'keyword',
            component: () => import(/* webpackChunkName: "es6-3-2" */ '@/views/es6/3/keyword/index.vue'),
          }
        ],
      },
      {
        meta:{
          title:'4.变量，作用域'
        },
        path: '4',
        children:[
          {
            meta:{
              title:'1-原始值与引用值'
            },
            path: 'key',
            component: () => import(/* webpackChunkName: "es6-4-1" */ '@/views/es6/4/key/index.vue'),
          }
        ],
      },
      {
        meta:{
          title:'8.对象，类与面向对象'
        },
        path: '8',
        component: routerView,
        children:[
          {
            meta:{
              title:'1-理解对象'
            },
            path: 'knowObject',
            component: () => import(/* webpackChunkName: "es6-4-1" */ '@/views/es6/8/knowObject/index.vue'),
          }
        ],
      }
    ]
  }
]

// 权限路由
export const RoleRoutes = [
  es6Route
]

const router = new VueRouter({
  routes,
})

export default router
